#include "epollServer.hpp"
#include <memory>

using namespace epoll_ns;

std::string transaction(const std::string& request)
{
    return "server respond # " + request;
}

inline void Usage(std::string proc)
{
    std::cout << "Usage : \n\t" << proc << " local_port\n\n";
}

int main(int argc, char* argv[])
{

    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }

    std::unique_ptr<EpollServer> server(new EpollServer(transaction, atoi(argv[1])));
    
    server->initServer();
    server->start();

    return 0;
}